import Vue from 'vue';
import Vuex from 'vuex'
import axios from '../utils/http'

Vue.use(Vuex);

const IndexStore = {
    namespaced: true,
    state: () => ({
        img_list: []
    }),
    mutations: {
        BannerMutation(state, img_list) {
            state.img_list = img_list
        }
    },

    actions: {
        BannerActions(context) {
            axios.get('/api/getbanner').then(
                res => {
                    var list = res.list;
                    context.commit('BannerMutation',list)
                }
            )
        }
    }
}

export default IndexStore

